package demo1;

public class Apple extends Fruit{

    public double weight;

    public Apple(String name, String color, double weight){
        super(name,color);
        this.weight = weight;
        System.out.println("子类的构造方法执行了");
    }

    {
        System.out.println("子类的实例代码块2被执行了");
    }

    {
        System.out.println("子类的实例代码块1被执行了");
    }

    static {
        System.out.println("子类的静态代码块2被执行了");
    }

    static {
        System.out.println("子类的静态代码块1被执行了");
    }

    @Override
    public String toString() {
        return "demo1.Apple{" +
                "weight=" + weight +
                ", name='" + name + '\'' +
                ", color='" + color + '\'' +
                '}';
    }
}
